<template>
  <Container>
    <Tabs v-model="tab">
      <Button 
        size="large" 
        class="item"
        slot="extra"
        icon="md-add"
        type="primary"
        @click="onEdit"
      >新增流程</Button>
      <TabPane label="业务通流程管理" name="tab1">
        <homeTable
          :list="list"
          :hasPage="false"
          @getData="getData"/>
      </TabPane>
    </Tabs>
    <ProcessEditItem ref="edit"></ProcessEditItem>
  </Container>
</template>
<script>
  import homeTable from "~/homeTable"
  import ProcessListData from "./list/ProcessListData"
  import ProcessEditItem from "./list/ProcessEditItem"
  export default {
    components: {
      homeTable,
      ProcessEditItem
    },
    data() {
      return {
        tab: "tab1",
        list: ProcessListData
      }
    },
    mounted() {
      this.getData()
      this.$bus.$on("onEdit", ({id}) => this.onEdit(id))
    },
    methods: {
      getData() {
        this.list.data = [{
          id: 1,
          name: '签约信息',
          title: '经销商业务员->经销商业务经理->品牌业务代表->渠道管理员',
          role: '经销商业务员，经销商业务经理',
          date: '2019.09.04 13:02:00',
          unit: '张三'
        }]
      },
      onEdit(id) {
        this.$refs.edit.open(id)
      }
    }
  }
</script>